import React from 'react';
import { Table } from 'antd';

const MultiSelectTable = ({ columns, dataSource, selectionType, onRowSelectionChange }) => {
    // 行选择配置
    const rowSelection = {
        type: selectionType,
        onChange: (selectedRowKeys, selectedRows) => {
            if (onRowSelectionChange) {
                onRowSelectionChange(selectedRowKeys, selectedRows);
            }
        },
        getCheckboxProps: (record) => ({
            disabled: record.name === 'Disabled User',
            name: record.name,
        }),
    };

    return (
        <Table
            rowSelection={rowSelection}
            columns={columns}
            dataSource={dataSource}
            pagination={false}
        />
    );
};

export default MultiSelectTable;